<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:cc="http://java.sun.com/jsf/composite"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<cc:interface>
		
		<cc:attribute name="tituloDialogo" default="Confirmação" />
		<cc:facet name="mensagemDialogo" required="true" />
		<cc:attribute name="widgetVar" required="true" />
		<cc:attribute name="simUpdate" required="true" />
		<cc:attribute name="naoUpdate" />
		<cc:attribute name="simOnClick" />
		<cc:attribute name="naoOnClick" />
		
		<cc:attribute name="scriptOnComplete" />
		<cc:attribute name="simAction"
			method-signature="java.lang.String action()" />
		<cc:attribute name="naoAction"
			method-signature="java.lang.String action()" />
		<cc:attribute name="notAjaxSim" required="false" />

	</cc:interface>

	<cc:implementation>

		<p:confirmDialog
			closable="false"
			modal="true" severity="info"
			appendToBody="true"
			header="#{cc.attrs.tituloDialogo}"
			message="#{cc.attrs.mensagemDialogo}"
			widgetVar="#{cc.attrs.widgetVar}">
			
			<f:facet name="message">
				<h:panelGroup layout="block" style="text-align: justify; width: 300px;">
					<cc:renderFacet name="mensagemDialogo" />
				</h:panelGroup>
			</f:facet>
			
			<h:panelGrid columns="5">
			
				<p:spacer width="20" />				

				<p:commandButton style="float:left"
					process="@this"
					value="#{locale['dialogos.botao.sim']}"
					action="#{cc.attrs.simAction}"
					title="#{locale['dialogos.botao.sim']}"
					rendered="#{not empty cc.attrs.simUpdate}"
					onclick="#{cc.attrs.simOnClick}"
					oncomplete="#{cc.attrs.widgetVar}.hide();#{cc.attrs.scriptOnComplete}"
					ajax="#{!cc.attrs.notAjaxSim}" update="#{cc.attrs.simUpdate}"
					icon="ui-icon-check" />

				<p:commandButton style="float:left"
					process="@this"
					value="#{locale['dialogos.botao.sim']}"
					action="#{cc.attrs.simAction}"
					title="#{locale['dialogos.botao.sim']}"
					rendered="#{empty cc.attrs.simUpdate}"
					onclick="#{cc.attrs.simOnClick}"
					oncomplete="#{cc.attrs.widgetVar}.hide();#{cc.attrs.scriptOnComplete}" 
					icon="ui-icon-check" />

				<p:spacer width="20" />

				<p:commandButton style="float:right"
					process="@this"
					value="#{locale['dialogos.botao.nao']}"
					action="#{cc.attrs.naoAction}"
					title="#{locale['dialogos.botao.nao']}"
					rendered="#{not empty cc.attrs.naoUpdate}"
					onclick="#{cc.attrs.naoOnClick}"
					oncomplete="#{cc.attrs.widgetVar}.hide();#{cc.attrs.scriptOnComplete}"
					update="#{cc.attrs.naoUpdate}"
					icon="ui-icon-closethick" />

				<p:commandButton style="float:right"
					process="@this"
					value="#{locale['dialogos.botao.nao']}"
					action="#{cc.attrs.naoAction}" title="#{cc.attrs.naoTitulo}"
					rendered="#{empty cc.attrs.naoUpdate}"
					onclick="#{cc.attrs.naoOnClick}"
					oncomplete="#{cc.attrs.widgetVar}.hide();#{cc.attrs.scriptOnComplete}"
					icon="ui-icon-closethick" />
					
				<p:spacer width="20" />

			</h:panelGrid>

		</p:confirmDialog>

	</cc:implementation>

</ui:composition>